#!/usr/bin/python

"""Classes that represent different kinds of animals."""

class Zviera(object):
  """Represents an animal"""

  def __init__(self):
    self.num_heads = 1
    self.num_tails = None
    self.num_legs = None
    self.fur_color = None
    self.name = None
    self.sound = None

  def Describe(self):
    return ('My name is %s, I have heads: %r, tails: %r, legs: %r, fur color: '
      '%s.' %(self.name, self.num_heads, self.num_tails, self.num_legs, 
      self.fur_color))
  
  def MakeSound(self):
    return '%s' %self.sound


class Macka(Zviera):
  """Represents a cat """

  def __init__(self, name, fur_color, sound):
    super(Macka, self).__init__()
    self.num_tails = 1
    self.num_legs = 4
    self.name = name
    self.fur_color = fur_color
    self.sound = sound
  
  def Spi(self):
    return 'A spim.'

class Pes(Zviera):
  """Represents a dog """
  def __init__(self, name, fur_color, sound):
    super(Pes, self).__init__()
    self.num_tails = 1
    self.num_legs = 4
    self.sound = sound
    self.name = name
    self.fur_color = fur_color

  def Dones(self):
    return 'A nech sa paci.'

class Had(Zviera):
  """Represents a snake """
  def __init__(self, name, fur_color, sound):
    super(Had, self).__init__()
    self.num_tails = 1
    self.num_legs = 0
    self.name = name
    self.fur_color = fur_color
    self.sound = sound

  def PlazSa(self):
    return 'A plazim sa.'

class Kohut(Zviera):
  """Represents a rooster. """
  def __init__(self, name, fur_color, sound):
    super(Kohut, self).__init__()
    self.num_tails = 1
    self.num_legs = 2
    self.sound = sound
    self.name = name
    self.fur_color = fur_color

def UvodneKeci(cls, name, fur_color, sound):
  instancia = cls(name, fur_color, sound)
  output = (
    'Creating instance %s.\n'
    'Calling %s.Describe(): %s\n'
    'Calling %s.MakeSound(): %s' % (name, name, instancia.Describe(), 
    name, instancia.MakeSound()))
  return (output, instancia)

def main():
  output, instancia = UvodneKeci(Macka, 'Fluffy', 'white', 'Miau')
  print output
  print 'Calling %s.Spi(): %s\n\n' % (instancia.name, instancia.Spi())
  
  output, instancia = UvodneKeci(Macka, 'Blackie', 'black', 'Miau')
  print output
  print 'Calling %s.Spi(): %s\n\n' % (instancia.name, instancia.Spi())
  
  output, instancia = UvodneKeci(Pes, 'Dunco', 'brown', 'Haf')
  print output
  print 'Calling %s.Dones(): %s\n\n' % (instancia.name, instancia.Dones())
  
  output, instancia = UvodneKeci(Had, 'Sykacka', None, 'Sssssss')
  print output
  print 'Calling %s.PlazSa(): %s\n\n' % (instancia.name, instancia.PlazSa())

  output, instancia = UvodneKeci(Kohut, 'Kikirikac', None, 'Kikiriki')
  print output


if __name__ =='__main__':
  main()
